// https://leetcode.cn/problems/find-smallest-letter-greater-than-target/
// Created by ade on 2022/8/16.
//
#include <iostream>
#include <vector>
#include <algorithm>


using namespace std;

class Solution {
public:
    char nextGreatestLetter1(vector<char> &letters, char target) {
        auto iter = upper_bound(letters.begin(), letters.end(), target);
        if (iter == letters.end()) return letters[0];
        return *iter;
    }
};

int main() {
    Solution so;
    vector<char> nums = {'c', 'f', 'j'};
    cout << so.nextGreatestLetter(nums, 'j') << endl;
    return 0;
}